<template>
	<view class="p20">
		<view class="flex-col row-center col-center  pt20">
			<image :src="$config.shop_logo||'/static/logo.png'" class="w120 h120" mode=""></image>
			<view class="mt20 mb20 fw-w">{{$config.shop_title||"陪诊"}}-用户端</view>
		</view>
		<view class="radius20 p30 mb20 bg-fff flex" @click="$jump('/pages/my/set/userInfo')">
			<view class="flex1">个人资料</view>
			<u-icon name="arrow-right" class="ml10 pe-none" />
		</view>
		<view class="radius20 p30 mb20 bg-fff flex"
			@click="$jump('/pages/public/text',{text:'member_pact',tit:'用户协议'})">
			<view class="flex1">用户协议</view>
			<u-icon name="arrow-right" class="ml10 pe-none" />
		</view>
		<view class="radius20 p30 mb20 bg-fff flex"
			@click="$jump('/pages/public/text',{text:'privacy_pact',tit:'隐私政策'})">
			<view class="flex1">隐私政策</view>
			<u-icon name="arrow-right" class="ml10 pe-none" />
		</view>
		<view class="radius20 p30 mb20 bg-fff flex" @click="$jump('/pages/public/text',{text:'about_us',tit:'关于我们'})">
			<view class="flex1">关于我们</view>
			<u-icon name="arrow-right" class="ml10 pe-none" />
		</view>
		<view class="radius20 p30 mb20 bg-fff flex pr" @click="clickUp">
			<view class="fs30 pr flex1">检查更新</view>
			<view class="">v{{version}}</view>
			<view class="als-s pr" v-if="isUp">
				<u-badge size="mini" type="error" count='1' is-center is-dot></u-badge>
			</view>
			<u-icon name='arrow-right' class="ml10 pe-none" />
		</view>
		<view class="radius20 p30 mb20 bg-fff flex" @click="$jump('logout')">
			<view class="flex1">注销账户</view>
			<u-icon name="arrow-right" class="ml10 pe-none" />
		</view>
		<block v-if="isOut">
			<view class="h120"></view>
			<view class="pf bottom0 left0  w-max">
				<view class="p20">
					<u-button type="warning" ripple @click="logOut">退出登录</u-button>
				</view>
			</view>
		</block>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				isUp: false,
				isOut: '1',
				version: ''
			}
		},
		onLoad() {
			// #ifdef APP-PLUS
			plus.runtime.getProperty(plus.runtime.appid, function(wgtinfo) {
				this.version = wgtinfo.version
			});
			// #endif
			// #ifndef APP-PLUS
			let appInfo = uni.getSystemInfoSync()
			this.version = appInfo.appWgtVersion || appInfo.appVersion
			// #endif


			// #ifdef MP-WEIXIN
			this.isOut = false
			// #endif
			// #ifdef H5
			let ua = window.navigator.userAgent.toLowerCase(); //判断的登录环境  //如果是微信公众号环境
			if (ua.indexOf('micromessenger') != -1) this.isOut = false
			// #endif


			// #ifdef APP-PLUS
			uni.$once('update', data => {
				if (data.data.code == 200) this.isUp = true
			})
			this.$z.update(0)
			// #endif
		},
		onUnload() {
			uni.$off('update')
		},
		methods: {
			clickUp() {
				// #ifndef APP-PLUS
				this.$msg('已是最新版本')
				// #endif
				// #ifdef APP-PLUS
				this.$z.update(2)
				// #endif
			},
			async logOut() {
				await this.$showModal('退出登录')
				this.Logout2()
			},
			Logout2() {
				this.$msg('退出登录')
				setTimeout(() => {
					this.$jump('/pages/login/login')
				}, 1000)
			}
		}
	}
</script>

<style lang="scss">

</style>